<script>
export default {
  name: "MainPageCard1",
  props:{
    img:{
      required:true,
      type:String,
    },
    mode:{
      required: true,
      type:Number
    },
    character:{
      required:true,
      type:String,
    },
    bColor:{
      required:true,
      type:String,
    },
  },
  data(){
    return{

    }
  }
}
</script>

<template>
  <div class="card-container" :style="{backgroundColor: bColor}">
    <img :class="{'left_img':mode === 1, 'right_img':mode ===2}" :src="img" alt="null">
    <div :class="{'right_ul':mode === 1, 'left_ul':mode === 2}">
      <ul :class="{'right_ul':mode === 1, 'left_ul':mode===2}">
        <li v-for="char in character" :key="char">{{char}}</li>
      </ul>
    </div>
  </div>
</template>

<style scoped>
  .card-container{
    width: 90px;
    height: 120px;
    position: relative;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.1);
    border-radius: 6px;
  }
  .card-container img{
    position: absolute;
    left: 50%;
    top: 50%;
    height: 90%;
  }
  .card-container .left_img{
    transform: translate(-90%,-45%);
    animation: c_moveAni1 3s infinite linear;
  }
  .card-container .right_img{
    transform: translate(-10%,-45%);
    animation: c_moveAni2 3s infinite linear;
    animation-delay: 1s;
  }
  @keyframes c_moveAni1 {
    0%{
      transform: translate(-90%,-45%);
    }
    50%{
      transform: translate(-90%,-50%);
    }
    100%{
      transform: translate(-90%,-45%);
    }
  }
  @keyframes c_moveAni2 {
    0%{
      transform: translate(-10%,-45%);
    }
    50%{
      transform: translate(-10%,-50%);
    }
    100%{
      transform: translate(-10%,-45%);
    }
  }
  .card-container ul{
    position: absolute;
    top: 50%;
    width: 50%;
    transform: translateY(-50%);
    height: 100%;
    display: flex;
    flex-direction: column;
    margin-top: 2%;
  }
  .card-container .right_ul{
    left: 50%;
  }
  .card-container .left_ul{
    left: 0;
  }
  .card-container li{
    text-align: center;
    font-size: 1em;
    list-style: none;
    font-weight: bolder;
    margin: 2px;
    color: white;
  }

</style>